package com.whx.search.web;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.pojo.Item;
import com.whx.search.pojo.dto.SearchDto;
import com.whx.search.pojo.vo.SearchVo;
import com.whx.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @Author whx
 * @Date 2024/11/14 17:10
 */
@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private SearchService searchService;

    /**
     * filter feature list all items' brand and category
     * @param searchDto
     * @return
     */
    @PostMapping("/filters")
    public SearchVo doFilter(@RequestBody SearchDto searchDto){
        return searchService.doFilter(searchDto);
    }

    /**
     * page
     * @return
     */
    @PostMapping("/list")
    public PageDTO<Item> pageDTO(@RequestBody SearchDto searchDto){
        return searchService.pageDto(searchDto);
    }



}
